package com.wl.shop.utils;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringEscapeUtils;

import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Maps;

public class Constants {
	/**
	 * DataTable把前台传递过来的json数据转成map
	 * @param json
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static  Map<String,Object> convertToMap(String json){
		List<Object>	 list = JSONArray.parseArray(StringEscapeUtils.unescapeHtml(json));
        Map<String,Object>	map =Maps.newHashMap();
        for(Object ob:list){
            Map<String,Object> param =(Map<String, Object>) ob;
          map.put(param.get("name")+"",param.get("value"));
        }
        return map;
	}
}
